/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.osiris.persistence;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author amartinez
 */
@Entity
@Table(name = "Tiporecurso")
@NamedQueries({@NamedQuery(name = "Tiporecurso.findAll", query = "SELECT t FROM Tiporecurso t"), @NamedQuery(name = "Tiporecurso.findByIdTipoRecurso", query = "SELECT t FROM Tiporecurso t WHERE t.idTipoRecurso = :idTipoRecurso"), @NamedQuery(name = "Tiporecurso.findByValor", query = "SELECT t FROM Tiporecurso t WHERE t.valor = :valor"), @NamedQuery(name = "Tiporecurso.findByDescripcion", query = "SELECT t FROM Tiporecurso t WHERE t.descripcion = :descripcion")})
public class Tiporecurso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idTipoRecurso")
    private Long idTipoRecurso;
    @Column(name = "Valor")
    private String valor;
    @Column(name = "Descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTipoRecurso", fetch = FetchType.LAZY)
    private List<Subtipo> subtipoList;

    public Tiporecurso() {
    }

    public Tiporecurso(Long idTipoRecurso) {
        this.idTipoRecurso = idTipoRecurso;
    }

    public Long getIdTipoRecurso() {
        return idTipoRecurso;
    }

    public void setIdTipoRecurso(Long idTipoRecurso) {
        this.idTipoRecurso = idTipoRecurso;
    }

    public String getValor() {
        return valor;
    }

    public void setValor(String valor) {
        this.valor = valor;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public List<Subtipo> getSubtipoList() {
        return subtipoList;
    }

    public void setSubtipoList(List<Subtipo> subtipoList) {
        this.subtipoList = subtipoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoRecurso != null ? idTipoRecurso.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tiporecurso)) {
            return false;
        }
        Tiporecurso other = (Tiporecurso) object;
        if ((this.idTipoRecurso == null && other.idTipoRecurso != null) || (this.idTipoRecurso != null && !this.idTipoRecurso.equals(other.idTipoRecurso))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.osiris.persistence.Tiporecurso[idTipoRecurso=" + idTipoRecurso + "]";
    }

}
